# Contributor: tcely <rdedup+aports@tcely.33mail.com>
# Maintainer: Celeste <cielesti@protonmail.com>
maintainer="Celeste <cielesti@protonmail.com>"
pkgname=rdedup
pkgver=3.2.1
pkgrel=5
pkgdesc="Data deduplication with compression and public key encryption"
url="https://github.com/dpc/rdedup"
# loongarch64: blocked by libc crate
arch="all !loongarch64"
license="MPL-2.0"
makedepends="
	bzip2-dev
	cargo
	cargo-auditable
	libsodium-dev
	xz-dev
	zstd-dev
	"
source="$pkgname-$pkgver.tar.gz::https://github.com/dpc/rdedup/archive/v$pkgver.tar.gz
	getrandom-0.2.10.patch
	system-zstd.patch
	"

export SODIUM_USE_PKG_CONFIG=1
export ZSTD_SYS_USE_PKG_CONFIG=1

prepare() {
	default_prepare

	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build --frozen --release
}

check() {
	cargo test --frozen
}

package() {
	install -Dvm755 target/release/rdedup -t "$pkgdir"/usr/bin/
}

sha512sums="
375265eab7c133000682fd8bf6bf023d69042571a737e707671874a9c5bada4c05742fd397207661f0c8334f0818e8a52707c412ca5cbec636469f6d9c7448c9  rdedup-3.2.1.tar.gz
216c9f6111406d2c2c18a2bdbe25678d32f22da7daf2eeff67a1f179e3b40b92b205652f4d8362b33246d50bb29540947138533a9f5bd13c60cb5d9da53edd02  getrandom-0.2.10.patch
3cdaa7074ef241889012cdcb46f80a27e5702b20053320559eb3de5a20be66267613f052ff967efd3959c0d502abfa86b299845eb5e52435d0c4ca0c7880aa85  system-zstd.patch
"
